﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PackageVersionExtensions.cs" company="In The Hand Ltd">
//   Copyright (c) 2013-15 In The Hand Ltd, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace InTheHand.ApplicationModel
{
    using System;
    using Windows.ApplicationModel;

    public static class PackageVersionExtensions
    {
        internal static PackageVersion ToPackageVersion(this Version version)
        {
            PackageVersion packageVersion = new PackageVersion();
            packageVersion.Major = (ushort)version.Major;
            packageVersion.Minor = (ushort)version.Minor;
            packageVersion.Build = (ushort)version.Build;
            packageVersion.Revision = (ushort)version.Revision;
            return packageVersion;
        }

        [CLSCompliant(false)]
        public static string ToString(this PackageVersion version, bool alwaysTrue)
        {
            return version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString() + "." + version.Revision.ToString();
        }
    }
}
